export default function r(msg: string, code = 0, data?: object) {
  const response: { msg: string; code: number; data?: object } = { code, msg }

  // 如果 data 存在，则将其添加到返回的对象中
  if (data !== undefined) {
    response.data = data
  }

  return response
}
